package FunctionalInteface_Consumer;

import java.util.function.Consumer;

public class ConsumerText {

	public static void main(String[] args) {
		String[] strArray = { "周杰伦,44", "吴彦祖,22", "陈冠希,33" };

		useConsumer(strArray, str -> {
			String name = str.split(",")[0];
			System.out.print("姓名:" + name + '\t');
		}, str -> {
			int age = Integer.parseInt(str.split(",")[1]);
			System.out.println("年龄:" + age);
		});

	}

	public static void useConsumer(String[] strArray, Consumer<String> con1, Consumer<String> con2) {
		for (String str : strArray) {
			con1.andThen(con2).accept(str);
		}
	}

}
